package com.cxcy.swustlearner.controller;

import com.cxcy.swustlearner.utils.AliOSSUtils;
import common.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RequestMapping("/public")
public class Public {
    private AliOSSUtils utils;
    @PostMapping("upload")
    public Result fileUpload(@RequestParam("file") MultipartFile file) throws IOException {
        String url= utils.upload(file);
        return Result.success(url);
    }
}